#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File  : post_blog.py
# @Author: OpenHair
# @Date  : 2022/8/25
# @Desc  : 将数据提交到博客
# @Contact : 674514904@qq.com

import asyncio
from pyppeteer import launch
import logging
from pyppeteer.errors import TimeoutError
import re
import common
# 插入数据库
import db
import pymongo
import sys
import random
import json

from dotenv import load_dotenv, find_dotenv
import os

# 获取站点
mysqldb = db.DbManager()

load_dotenv(verbose=True)

# noinspection PyBroadException
try:
    mongo_collection = pymongo.MongoClient(os.getenv('MONGOD_HOST'), os.getenv(
        'MONGOD_PORT'))  # 如 mongodb://admin:123456@192.168.221.128:27017
    mongo_collection.server_info()
except IOError as e:
    print("输入/输出操作失败")
    sys.exit()
except Exception as e:
    print("数据库配置异常,请检查...")
    sys.exit()


class PostBlog:

    def __init__(self):
        mongo_db = mongo_collection['article']
        mongo_collection_model = mongo_db['man']
